# -*- coding:utf-8 -*-
from TestBase.browser_action import Base
from TestBase.webdriver_package import *


class BuyPage(Base):

    def __init__(self, case_instance):
        super(BuyPage, self).__init__(case_instance, csv_file="buy_page.csv")

    # 输入信息，完成购买
    def buy_ticket(self):
        self.name_input().clear()
        self.name_input().send_keys(self.data("name"))
        time.sleep(2)

        self.idcard_input().clear()
        self.idcard_input().send_keys(self.data("idcard"))
        time.sleep(2)

        self.screenshot(img_no=1)
        self.assert_content(content=self.data("assert_other_key"), error_msg="车票购买失败")
